<?php
// 任务数据操作Action
class TaskAction extends Action {
	public function page_list() {
		$start = $_GET ['start'];
		$limit = $_GET ['limit'];
		$task = M ( 'Task' ); // 实例化模型类
		$list = $task->limit ( "$start,$limit" )->select (); // 查询数据
		$totalCount = $task->count (); // 查询数据
		echo json_encode ( array ("data" => $list, "totalCount" => $totalCount ) );
	}
	
	public function add() {
		$task_desc = $_GET ['task_desc'];
		$task_type = $_GET ['task_type'];
		$task = M ( 'Task' ); // 实例化模型类
		echo $task->add ( array ("task_desc" => $task_desc, "task_type" => $task_type ) );
		echo json_encode ( array ("success" => true ) );
	}
}